﻿using System;
using System.Data;
using System.Data.Odbc;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;

/// <summary>
/// Summary description for MySql
/// </summary>
public class ReviewerMySql
{
    public string ConnStr = ConfigurationManager.ConnectionStrings["reviewer"].ConnectionString;
    
    public ReviewerMySql()
	{
		//
		// TODO: Add constructor logic here
		//
	}

    public OdbcDataReader ExecuteReader(string SQL)
    {
        OdbcConnection conn = new OdbcConnection(ConnStr);
        using (OdbcCommand cmd = new OdbcCommand()) 
        {
            conn.Open();
            cmd.Connection = conn;
            cmd.CommandType = CommandType.Text;
            cmd.CommandText = SQL;
            return cmd.ExecuteReader();
            conn.Close();
        }
    }

    public string ExecuteNonQuery(string SQL)
    {
        OdbcConnection conn = new OdbcConnection(ConnStr);
        using (OdbcCommand cmd = new OdbcCommand())
        {
            conn.Open();
            cmd.Connection = conn;
            cmd.CommandType = CommandType.Text;
            cmd.CommandText = SQL;
            cmd.ExecuteNonQuery();
            conn.Close();
            return "OK";
        }
    }
}